﻿using System;
using System.Drawing;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using cz.zcu.PreSti.DirectX;
using System.Collections.Generic;

namespace cz.zcu.PreSti.Components
{
    public class Getter : RunnableComponent
    {
        private Subdiagram diagram;
        private int getterIndex = 0;
        private object getterValue = null;

        public Getter(IPresentation p, Subdiagram diagram = null)
            : base(p, 0, 0, 1, 0)
        {
            this.diagram = diagram;
        }

        #region parameters

        public Subdiagram Diagram
        {
            get
            {
                return diagram;
            }
            set
            {
                diagram = value;
            }
        }

        public int GetterIndex
        {
            get
            {
                return getterIndex;
            }
            set
            {
                getterIndex = value;
            }
        }

        public object Value
        {
            get
            {
                return getterValue;
            }
            set
            {
                getterValue = value;
            }
        }

        #endregion

        public void updateSetters()
        {
            base.retrieveValuesFromGetters();
        }

        public override void setValueToSetter(int setterN, object value)
        {
            base.setValueToSetter(setterN, value);
            switch (setterN)
            {
                case 0:
                    string val = "";
                    convertValue(ref val, value);
                    getterValue = val;
                    //getterValue = value;
                    break;
            }
        }

        public override void update() { }

        public new void trigIn(int n) { }

        private void onFinished(object sender, EventArgs e) { }
    }
}